package db.vector;

import db.AbstractService;
import db.nutriment.Nutriment;
import db.nutriment.NutrimentService;

public class VectorService extends AbstractService<Vector> implements VectorDAO
{
    private NutrimentService nutrimentService;
    
    public void setNutrimentService(NutrimentService nutrimentService) {
        this.nutrimentService = nutrimentService;
    }
    
    public void addNutriment(Long vectorId, Long nutrimentId) {
        Vector vector = find(vectorId);
        Nutriment nutriment = nutrimentService.find(nutrimentId);
        vector.getNutriments().add(nutriment);
        insert(vector);
    }
}